tupel_list = [(1, 2), (3, -1), (0, 4)]
print(max(tupel_list, key=lambda x: x[1]))
print(min(tupel_list))
# error
# print([3,-1]-[0,4])

from functools import lru_cache, cache
from typing import List, Tuple
import numpy as np
from numpy.typing import NDArray

# TypeError: unhashable type: 'list'
# @lru_cache(maxsize=1)
# # @cache


@lru_cache(maxsize=1)
def test_lru_cache(var: Tuple):
    print(var)


test_lru_cache(tuple([(1, 2), (3, -1), (0, 4)]))


import torch

# batch_size, embed_dim, height, width
tensor = torch.rand(size=(8, 768, 16, 16))
print(tensor.shape)

interpolate_tensor = torch.nn.functional.interpolate(
    tensor, size=(20, 10), mode="bicubic"
)
print(interpolate_tensor.shape)


def assert_test():
    # False assertion,True pass
    assert True


assert_test()

import threading
import multiprocessing
import time


def timer_func():
    tm_str = time.strftime("%H:%M:%S", time.gmtime())
    print(tm_str)


def timer_test():
    timer = threading.Timer(1, timer_func)
    print("Starting timer")
    timer.start()

    max_loop = 10
    loop_count = 0

    while True:

        time.sleep(0.5)
        loop_count += 1
        if loop_count >= max_loop:
            print("timer_test end")
            timer.cancel()
            break


timer_test()
